The Profiler Window
Topic Groups



The "Profiler" window is a tool that can be use to measure, in time, the performances of your scripts. It can also be very useful to find out where exactly you should improve syntax logic to gain performances. The precision of this profiler goes down to microseconds (millionth of a second = 0.000001s = 10-6s). The profiler also provides useful information such as the Lua's VM memory at the moment of the call, the line and file path and name related to the call, overall duration usage, the nature of the call, etc.

The Main call
The profiler will never display informations in runtime to provide the most accurate data as possible. The information will instead be displayed as soon as the script is stopped. (due to error, user or normally) It will always have a [MAIN] call. That call is the script's entry call and will always have a 100% overall usage since it's the call that starts and end the script. Use the [MAIN] call to have an idea of the complete run duration of your script.

Interpreting Your Results
The profiler, as mentioned, can be a very powerful and useful tool to pinpoint your scripts' weaknesses or poor performances. To do so, LuaEdit provide a multitude of information for each call made in your script. Here is the complete list of those information:

  • Function Name: The name of the function that was called.
  • Line: The line number where the call was made.
  • Source: The nature of the call. (either 'C' or 'Lua' depending of where the function was declared)
  • Relative Usage: Percentage representating the time usage of the call relative to the previous call.
  • Overall Usage: Percentage representating the time usage according to the [MAIN] call.
  • Duration: Total call duration time in seconds.
  • Enter Time: The most accurate time possible when the call was made.
  • Exit Time: The most accurate time possible when the call returned.
  • Lua Memory: The amount of memory used by Lua's virtual machine at the moment of the call.
Tip1: A very large large amount of memory used by Lua's virtual machine can be the source of poor performances.
Tip2: Put your attention and sweath toward functions that are taking most of your overall processing time. Sometimes, simply reorganizing the code can improve the performances.

Residual Processes
When a script is running, a large amount of processing time is spent to code logic itself. That is, all if statements, for and while loops, variable declaration and accessing, etc. This time is spent somewhere and is displayed as [RESIDUAL PROCESSES].

Note1: Be aware that if LuaEdit hits a breakpoint, this will "falsify" the results. To get "true" performances values, you should always run the script from begining to end without hitting a breakpoint.

Note2: If all the results from the profiler are equal to zero (0), it might means that your hardware setup does not support high performances counter and high performances frequencies.


The Profiler Window



www.luaedit.net
© Copyright 2004-2007 Jean-Francois Goulet
LuaEdit 3.0.4 for Lua 5.1